import org.jibble.pircbot.*;
import java.lang.String.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class MyBot extends PircBot {

    public MyBot() {
        this.setName("Titty_Kitty");
    }

    public void onMessage(String channel, String sender,
                       String login, String hostname, String message) {
               // String trigger = message.substring(0,1);
               // String msg = message.substring(0,5);
                //String msg2 = message.substring(1,7);
     //  if (message.equalsIgnoreCase(".")){
            if (message.equalsIgnoreCase(".porn")){
                String[] websites = {"www.redtube.com",
                                        "www.youporn.com",
                                        "www.pornhub.com",
                                        "www.spankwire.com",
                                        "www.keezmovies.com",
                                        "www.dumpfly.com", "www.tube8.com",
                                        "www.fantasti.cc", "www.xvideos.com",
                                        "www.darktube.com", "www.fuckingmachines.com",
                                        "www.seehersquirt.com", "www.4tube.com",
                                        "www.4gifs.com", "www.boysfood.com",
                                        "www.slutload.com", "www.xnxx.com",
                                        "www.stfu.com"};

                List<String> list = Arrays.asList(websites);
                Collections.shuffle(list);
                sendMessage(sender, websites[7] + " Happy Fapping!");
                }
            else if (message.startsWith(".say")) {
                if (sender.equalsIgnoreCase("Spiky")){
                    String text = message.substring(5);
                    sendMessage(channel, text);
              } else {
                    sendMessage(channel, "I'm sorry, you are not authorized to run this command.");
           }
                
            }

            else if (message.startsWith (".join")){
                if (sender.equalsIgnoreCase("Spiky")){
                    String chjoin = message.substring(6);
                    joinChannel(chjoin);
              } else {
                    sendMessage(channel, "I'm sorry, you are not authorized to run this command.");
           }
                
            }
            else if (message.startsWith(".help")){
                String helps = message.substring(6);
                    if (helps.equalsIgnoreCase("porn")){
                        sendMessage(sender, sender + ", The .porn command returns a random " +
                                "pornography website so you can fap to new stuff!");}
                    else if (helps.equalsIgnoreCase("8ball")){
                        sendMessage(sender, sender + ", The !8ball command is from ChanServ" +
                                " and it serves as a 'fortune' command, just write !8ball" +
                                " <yes or no question>.");}
           
                    
                    
            }

            else if (message.startsWith(".name")){
                if (sender.equalsIgnoreCase("Spiky") || sender.equalsIgnoreCase("fpmankills")){
                    String nick = message.substring(5);
                    changeNick(nick);                        
              } else {
                    sendMessage(channel, "I'm sorry, you are not authorized to run this command.");
                }
                  
            }
            else  if (message.equalsIgnoreCase(".endbot")){
                if (sender.equalsIgnoreCase("Spiky")){
                    disconnect();
              } else {
                    sendMessage(channel, "I'm sorry, you are not authorized to run this command.");
           }

       }

    }

}





    

